package practise.alogrithm.gotoSiliconValley.array;

import java.util.Arrays;
import java.util.Random;

/**
 * Created by Richard on 8/4/2014.
 */
public class RandomNumberInRange {
    public int randomNumberInRange(int start, int end,int[] filterNumbers){
        Arrays.sort(filterNumbers);
        Random random = new Random();
        int range = end-start;
        int result = random.nextInt(range)+start;
        while(Arrays.binarySearch(filterNumbers,result)>=0){
            result = random.nextInt(range)+start;
        }
        return result;
    }
}
